let windowWidth = 0,
  windowHeight = 0;
wx.getWindowInfo({
  success(e) {
    windowWidth = e.windowWidth, windowHeight = e.windowHeight
  }
});

const getSystemInfo = () => [windowWidth, windowHeight],
  getUniqueKey = (() => {
    let e = 0;
    return function () {
      return (new Date).getTime() + e++
    }
  })(),
  bindInstance = () => {
    let e = {};
    return {
      getInstance: () => e,
      set: (t, n = null) => (e[t] || (e[t] = n), e[t]),
      get: t => e[t] || null,
      clear: () => {
        e = {}
      },
      remove: t => {
        e[t] && delete e[t]
      },
      removeAllByKey: t => {
        if (e[t]) {
          for (let n of e[t]) e[n] && delete e[n];
          delete e[t]
        }
      }
    }
  };
module.exports = {
  getSystemInfo: getSystemInfo,
  getUniqueKey: getUniqueKey,
  cacheInstance: bindInstance()
};
